import { useQuasar } from 'quasar';
import { ref, watchEffect } from 'vue';

export const useIsDarkActive = () => {
  const $q = useQuasar();
  const isDarkActive = ref(false);
  watchEffect(() => {
    isDarkActive.value = $q.dark.isActive;
  });
  return isDarkActive;
};

export const isDarkApp = () => localStorage.getItem('dark:app') === '1';

export const isUnknownDarkApp = () => localStorage.getItem('dark:app') === null;

export const setDarkApp = (dark: boolean) => localStorage.setItem('dark:app', dark ? '1' : '0');
